import { reqGetSearchInfo } from '@/api'

const actions = {
    async getSearchInfo({ commit }, params = {}) {
        let result = await reqGetSearchInfo(params);
        if (result.code == 200) {
            commit("GETSEARCHINFO", result.data)
        }

    }
};

const mutations = {
    GETSEARCHINFO(state, data) {
        state.searchInfo = data
    }

};

const state = {
    searchInfo: {}
};

const getters = {
    goodsList() {
        return state.searchInfo.goodsList || []
    },
    trademarkList() {
        return state.searchInfo.trademarkList || []
    },
    attrsList() {
        return state.searchInfo.attrsList || []
    }

};

export default {
    actions,
    mutations,
    state,
    getters
}